﻿using Microsoft.AspNetCore.Mvc;
using WCS.Infrastructure.Attr;
using WCS.Infrastructure.Dto.Request.Line;
using WCS.Infrastructure.Dto.Request.Payment;
using WCS.Service.Instance;
using WCS.Service.Interface;

namespace WCS.Api.Admin.Controllers
{
    /// <summary>
    /// 线路模块
    /// </summary>
    public class LineController : BaseController
    {

        private readonly IConfiguration _configuration;
        private readonly ILineService _lineService;
       

        public LineController(IConfiguration configuration, ILineService lineService, IUserService userService) : base(userService)
        {
            _configuration = configuration;
            _lineService = lineService;
        }

        /// <summary>
        /// 新增线路打卡记录
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost]
        [ActionLog(Action = "新增线路打卡记录", Group = "线路模块")]
        public async Task<IActionResult> AddLinePunchRecord(LinePunchRecordCreateRequestDto dto)
        {
            var result = await _lineService.AddLinePunchRecordAsync(dto);
            return Ok(result);
        }

        /// <summary>
        /// 更新线路打卡记录
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost]
        [ActionLog(Action = "更新线路打卡记录", Group = "线路模块")]
        public async Task<IActionResult> UpdateLinePunchRecord(LinePunchRecordCreateRequestDto dto)
        {
            var result = await _lineService.UpdateLinePunchRecordAsync(dto);
            return Ok(result);
        }

        /// <summary>
        /// 获取线路打卡记录
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="lineId"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> GetLinePunchRecord(string? userId, string lineId)
        {
            var result = await _lineService.GetLinePunchRecordAsync(userId, lineId);
            return Ok(result);
        }

    }
}
